Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mc_cursor finishes returning before stopping #256

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

samwar
Copy link

@samwar samwar commented Apr 12, 2023

Prior to this, mc_cursor processes would shut down after returning the last result, rather than after
returning a final 'empty' to callers. This caused callers to try to call back for 'next()' again when
cursor was already down or going down. That call is a gen_server:call(). In the best case, the process
would already be down, and the call would result in a noproc exit, which this code catches and
translates into a return value of 'error', instead of the correct {} value. In rare cases, though,
due to gen_server code, the call would occur at the moment the process terminates, and you'll get
an exit(normal) on the calling process instead.

@samwar samwar force-pushed the cursor-stop-race-condition branch from d993a9e to b90dee0 Compare April 13, 2023 02:19
Prior to this, `mc_cursor` processes would shut down after returning the last result, rather than after
returning a final 'empty' to callers. This caused callers to try to call back for 'next()' again when
cursor was already down or going down. That call is a `gen_server:call()`. In the best case, the process
would already be down, and the call would result in a `noproc` exit, which this code catches and
translates into a return value of 'error', instead of the correct `{}` value. In rare cases, though,
due to `gen_server` code, the call would occur at the moment the process terminates, and you'll get
an `exit(normal)` on the calling process instead.
@samwar samwar force-pushed the cursor-stop-race-condition branch from b90dee0 to a35f5df Compare April 2, 2024 21:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant